package wxk.interview.sort;

/**
 * @author wangxuekai
 * @version 1.0
 * @date 2017/3/4.
 */
abstract class AbstractSort implements Sort {

    void swap(int[] arr, int i, int j) {
        System.out.println("swap--->old={arr[" + i + "]=" + arr[i] + ",arr[" + j + "]=" + arr[j] + "}");
        arr[i] = arr[i] ^ arr[j];
        arr[j] = arr[i] ^ arr[j];
        arr[i] = arr[i] ^ arr[j];
        System.out.println("swap--->new={arr[" + i + "]=" + arr[i] + ",arr[" + j + "]=" + arr[j] + "}");
    }

    void print(int[] arr) {
        System.out.print("排序后的数组为:[ ");
        for (int i : arr) {
            System.out.print(i + " ");
        }
        System.out.println("]");
    }
}
